package com.gaussian.property.module.biz.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gaussian.property.module.biz.entity.AppUser;
import com.gaussian.property.module.biz.mapper.AppUserMapper;
import com.gaussian.property.module.biz.service.IAppUserService;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * <p>
 * 用户信息 服务实现类
 * </p>
 *
 * @author songqi(13776346982)
 * @since 2024-04-18
 */
@Service
public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> implements IAppUserService {


    @Override
    public Map<String, AppUser> queryAppUserMap(Collection<String> appUsernameList) {
        List<AppUser> appUserList = super.listByIds(appUsernameList);
        if(CollectionUtil.isNotEmpty(appUserList)) {
            return appUserList.stream().collect(Collectors.toMap(AppUser::getAppUserId, t -> t));
        }
        return Collections.emptyMap();
    }
}
